3.2.48 \(\int \frac {\tan ^2(a+i \log (x))}{x^2} \, dx\) [148]

Optimal. Leaf size=60 \[ \frac {e^{2 i a}}{x \left (e^{2 i a}+x^2\right )}+\frac {3 x}{e^{2 i a}+x^2}+2 e^{-i a} \text {ArcTan}\left (e^{-i a} x\right ) \]

[Out]

exp(2*I*a)/x/(exp(2*I*a)+x^2)+3*x/(exp(2*I*a)+x^2)+2*arctan(x/exp(I*a))/exp(I*a)

________________________________________________________________________________________

Rubi [A]
time = 0.05, antiderivative size = 60, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, integrand size = 15, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {4591, 456, 473, 393, 209} \begin {gather*} 2 e^{-i a} \text {ArcTan}\left (e^{-i a} x\right )+\frac {3 x}{x^2+e^{2 i a}}+\frac {e^{2 i a}}{x \left (x^2+e^{2 i a}\right )} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Tan[a + I*Log[x]]^2/x^2,x]

[Out]

E^((2*I)*a)/(x*(E^((2*I)*a) + x^2)) + (3*x)/(E^((2*I)*a) + x^2) + (2*ArcTan[x/E^(I*a)])/E^(I*a)

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 393

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[(-(b*c - a*d))*x*((a + b*x^n)^(p
 + 1)/(a*b*n*(p + 1))), x] - Dist[(a*d - b*c*(n*(p + 1) + 1))/(a*b*n*(p + 1)), Int[(a + b*x^n)^(p + 1), x], x]
 /; FreeQ[{a, b, c, d, n, p}, x] && NeQ[b*c - a*d, 0] && (LtQ[p, -1] || ILtQ[1/n + p, 0])

Rule 456

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.), x_Symbol] :> Int[x^(m + n*(p + q
))*(b + a/x^n)^p*(d + c/x^n)^q, x] /; FreeQ[{a, b, c, d, m, n}, x] && NeQ[b*c - a*d, 0] && IntegersQ[p, q] &&
NegQ[n]

Rule 473

Int[((e_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_))^2, x_Symbol] :> Simp[c^2*(e*x)^(m
 + 1)*((a + b*x^n)^(p + 1)/(a*e*(m + 1))), x] - Dist[1/(a*e^n*(m + 1)), Int[(e*x)^(m + n)*(a + b*x^n)^p*Simp[b
*c^2*n*(p + 1) + c*(b*c - 2*a*d)*(m + 1) - a*(m + 1)*d^2*x^n, x], x], x] /; FreeQ[{a, b, c, d, e, p}, x] && Ne
Q[b*c - a*d, 0] && IGtQ[n, 0] && LtQ[m, -1] && GtQ[n, 0]

Rule 4591

Int[((e_.)*(x_))^(m_.)*Tan[((a_.) + Log[x_]*(b_.))*(d_.)]^(p_.), x_Symbol] :> Int[(e*x)^m*((I - I*E^(2*I*a*d)*
x^(2*I*b*d))/(1 + E^(2*I*a*d)*x^(2*I*b*d)))^p, x] /; FreeQ[{a, b, d, e, m, p}, x]

Rubi steps

\begin {align*} \int \frac {\tan ^2(a+i \log (x))}{x^2} \, dx &=\int \frac {\tan ^2(a+i \log (x))}{x^2} \, dx\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.12, size = 72, normalized size = 1.20 \begin {gather*} \frac {1}{x}+2 \text {ArcTan}(x (\cos (a)-i \sin (a))) \cos (a)-2 i \text {ArcTan}(x (\cos (a)-i \sin (a))) \sin (a)+\frac {2 x (\cos (a)-i \sin (a))}{\left (1+x^2\right ) \cos (a)-i \left (-1+x^2\right ) \sin (a)} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Tan[a + I*Log[x]]^2/x^2,x]

[Out]

x^(-1) + 2*ArcTan[x*(Cos[a] - I*Sin[a])]*Cos[a] - (2*I)*ArcTan[x*(Cos[a] - I*Sin[a])]*Sin[a] + (2*x*(Cos[a] -
I*Sin[a]))/((1 + x^2)*Cos[a] - I*(-1 + x^2)*Sin[a])

________________________________________________________________________________________

Maple [A]
time = 0.05, size = 38, normalized size = 0.63

method result size
risch \(\frac {1}{x}+\frac {2}{x \left (1+\frac {{\mathrm e}^{2 i a}}{x^{2}}\right )}+2 \arctan \left (x \,{\mathrm e}^{-i a}\right ) {\mathrm e}^{-i a}\) \(38\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(a+I*ln(x))^2/x^2,x,method=_RETURNVERBOSE)

[Out]

1/x+2/x/(1+exp(2*I*a)/x^2)+2*arctan(x*exp(-I*a))*exp(-I*a)

________________________________________________________________________________________

Maxima [B] Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 223 vs. \(2 (45) = 90\).
time = 0.55, size = 223, normalized size = 3.72 \begin {gather*} \frac {6 \, x^{2} - 2 \, {\left (x^{3} {\left (\cos \left (a\right ) - i \, \sin \left (a\right )\right )} + {\left ({\left (\cos \left (a\right ) - i \, \sin \left (a\right )\right )} \cos \left (2 \, a\right ) + {\left (i \, \cos \left (a\right ) + \sin \left (a\right )\right )} \sin \left (2 \, a\right )\right )} x\right )} \arctan \left (\frac {2 \, x \cos \left (a\right )}{x^{2} + \cos \left (a\right )^{2} - 2 \, x \sin \left (a\right ) + \sin \left (a\right )^{2}}, \frac {x^{2} - \cos \left (a\right )^{2} - \sin \left (a\right )^{2}}{x^{2} + \cos \left (a\right )^{2} - 2 \, x \sin \left (a\right ) + \sin \left (a\right )^{2}}\right ) + {\left (x^{3} {\left (-i \, \cos \left (a\right ) - \sin \left (a\right )\right )} + {\left ({\left (-i \, \cos \left (a\right ) - \sin \left (a\right )\right )} \cos \left (2 \, a\right ) + {\left (\cos \left (a\right ) - i \, \sin \left (a\right )\right )} \sin \left (2 \, a\right )\right )} x\right )} \log \left (\frac {x^{2} + \cos \left (a\right )^{2} + 2 \, x \sin \left (a\right ) + \sin \left (a\right )^{2}}{x^{2} + \cos \left (a\right )^{2} - 2 \, x \sin \left (a\right ) + \sin \left (a\right )^{2}}\right ) + 2 \, \cos \left (2 \, a\right ) + 2 i \, \sin \left (2 \, a\right )}{2 \, {\left (x^{3} + x {\left (\cos \left (2 \, a\right ) + i \, \sin \left (2 \, a\right )\right )}\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(a+I*log(x))^2/x^2,x, algorithm="maxima")

[Out]

1/2*(6*x^2 - 2*(x^3*(cos(a) - I*sin(a)) + ((cos(a) - I*sin(a))*cos(2*a) + (I*cos(a) + sin(a))*sin(2*a))*x)*arc
tan2(2*x*cos(a)/(x^2 + cos(a)^2 - 2*x*sin(a) + sin(a)^2), (x^2 - cos(a)^2 - sin(a)^2)/(x^2 + cos(a)^2 - 2*x*si
n(a) + sin(a)^2)) + (x^3*(-I*cos(a) - sin(a)) + ((-I*cos(a) - sin(a))*cos(2*a) + (cos(a) - I*sin(a))*sin(2*a))
*x)*log((x^2 + cos(a)^2 + 2*x*sin(a) + sin(a)^2)/(x^2 + cos(a)^2 - 2*x*sin(a) + sin(a)^2)) + 2*cos(2*a) + 2*I*
sin(2*a))/(x^3 + x*(cos(2*a) + I*sin(2*a)))

________________________________________________________________________________________

Fricas [A]
time = 3.27, size = 78, normalized size = 1.30 \begin {gather*} \frac {3 \, x^{2} e^{\left (i \, a\right )} + {\left (i \, x^{3} + i \, x e^{\left (2 i \, a\right )}\right )} \log \left (x + i \, e^{\left (i \, a\right )}\right ) + {\left (-i \, x^{3} - i \, x e^{\left (2 i \, a\right )}\right )} \log \left (x - i \, e^{\left (i \, a\right )}\right ) + e^{\left (3 i \, a\right )}}{x^{3} e^{\left (i \, a\right )} + x e^{\left (3 i \, a\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(a+I*log(x))^2/x^2,x, algorithm="fricas")

[Out]

(3*x^2*e^(I*a) + (I*x^3 + I*x*e^(2*I*a))*log(x + I*e^(I*a)) + (-I*x^3 - I*x*e^(2*I*a))*log(x - I*e^(I*a)) + e^
(3*I*a))/(x^3*e^(I*a) + x*e^(3*I*a))

________________________________________________________________________________________

Sympy [A]
time = 0.30, size = 54, normalized size = 0.90 \begin {gather*} - \frac {- 3 x^{2} - e^{2 i a}}{x^{3} + x e^{2 i a}} - \left (i \log {\left (x - i e^{i a} \right )} - i \log {\left (x + i e^{i a} \right )}\right ) e^{- i a} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(a+I*ln(x))**2/x**2,x)

[Out]

-(-3*x**2 - exp(2*I*a))/(x**3 + x*exp(2*I*a)) - (I*log(x - I*exp(I*a)) - I*log(x + I*exp(I*a)))*exp(-I*a)

________________________________________________________________________________________

Giac [A]
time = 0.55, size = 73, normalized size = 1.22 \begin {gather*} 2 \, {\left (\arctan \left (x e^{\left (-i \, a\right )}\right ) e^{\left (-3 i \, a\right )} + \frac {x e^{\left (-2 i \, a\right )}}{x^{2} + e^{\left (2 i \, a\right )}}\right )} e^{\left (2 i \, a\right )} + \frac {5}{x {\left (\frac {e^{\left (2 i \, a\right )}}{x^{2}} + 1\right )}} + \frac {e^{\left (2 i \, a\right )}}{x^{3} {\left (\frac {e^{\left (2 i \, a\right )}}{x^{2}} + 1\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(a+I*log(x))^2/x^2,x, algorithm="giac")

[Out]

2*(arctan(x*e^(-I*a))*e^(-3*I*a) + x*e^(-2*I*a)/(x^2 + e^(2*I*a)))*e^(2*I*a) + 5/(x*(e^(2*I*a)/x^2 + 1)) + e^(
2*I*a)/(x^3*(e^(2*I*a)/x^2 + 1))

________________________________________________________________________________________

Mupad [B]
time = 2.20, size = 45, normalized size = 0.75 \begin {gather*} \frac {2\,\mathrm {atan}\left (\frac {x}{\sqrt {{\mathrm {e}}^{a\,2{}\mathrm {i}}}}\right )}{\sqrt {{\mathrm {e}}^{a\,2{}\mathrm {i}}}}+\frac {3\,x^2+{\mathrm {e}}^{a\,2{}\mathrm {i}}}{x^3+{\mathrm {e}}^{a\,2{}\mathrm {i}}\,x} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(a + log(x)*1i)^2/x^2,x)

[Out]

(2*atan(x/exp(a*2i)^(1/2)))/exp(a*2i)^(1/2) + (exp(a*2i) + 3*x^2)/(x^3 + x*exp(a*2i))

________________________________________________________________________________________